/* OPTIONS OBS=500 NOREPLACE; */   
 
%include "ASMimplibs.sas";



/** 05/05/2015: Modified to save the files with imputation type groups and Beta model flags to
            	the allcmf library.    
	    	Modified to read in all of the variables that we need to compute plant TFP.
***/


data cmf2002_nonar (KEEP=survu_id lbdnum firmid et form_proc tab tab_f tae tae_f ee ee_f 
           cf cf_f cm cm_f ph ph_f ph_nl ph_nl_f tvs tvs_f tib tie tib_f tie_f ww ww_f pw_f pw_nl_f ww_nl ww_nl_f te te_f te_nl_f sw sw_f sw_nl sw_nl_f NAICS_NEW_6 /*
*/           pw_f_missing ww_f_missing ph_f_missing nph_nl_imp npw_imp npw_nl_imp nww_nl_imp nte_nl_imp nte_imp nww_imp nsw_imp nph_imp 
            ncm_imp ntab_imp ntvs_imp any_impute  any_imp_notTIB_TIE any_imp_incl_TAB year);
 set cmf.cmf2002;
 year = 2002;
 NAICS_NEW_6 = substr(NAICS_NEW,1,6);
 if ar ne 1 and TABBED="Y";
if pw_F in (" B"," D"," E"," H"," J"," L"," M"," P"," S"," T"," V"," W", /*
          */"RB","RD","RE","RH","RJ","RL","RM","RP","RS","RT","RV","RW") 
then npw_imp = 1; else npw_imp = 0;
if pw_nl_F in (" B"," D"," E"," H"," J"," L"," M"," P"," S"," T"," V"," W", /*
          */"RB","RD","RE","RH","RJ","RL","RM","RP","RS","RT","RV","RW") 
then npw_nl_imp = 1; else npw_nl_imp = 0;

if te_F in (" B"," D"," E"," H"," J"," L"," M"," P"," S"," T"," V"," W", /*
          */"RB","RD","RE","RH","RJ","RL","RM","RP","RS","RT","RV","RW") 
then nte_imp = 1; else nte_imp = 0;
if te_nl_F in (" B"," D"," E"," H"," J"," L"," M"," P"," S"," T"," V"," W", /*
          */"RB","RD","RE","RH","RJ","RL","RM","RP","RS","RT","RV","RW") 
then nte_nl_imp = 1; else nte_nl_imp = 0;
if ww_F in (" B"," D"," E"," H"," J"," L"," M"," P"," S"," T"," V"," W", /*
          */"RB","RD","RE","RH","RJ","RL","RM","RP","RS","RT","RV","RW") 
then nww_imp = 1; else nww_imp = 0;
if ww_nl_F in (" B"," D"," E"," H"," J"," L"," M"," P"," S"," T"," V"," W", /*
          */"RB","RD","RE","RH","RJ","RL","RM","RP","RS","RT","RV","RW") 
then nww_nl_imp = 1; else nww_nl_imp = 0;
if sw_F in (" B"," D"," E"," H"," J"," L"," M"," P"," S"," T"," V"," W", /*
          */"RB","RD","RE","RH","RJ","RL","RM","RP","RS","RT","RV","RW") 
then nsw_imp = 1; else nsw_imp = 0;
if sw_nl_F in (" B"," D"," E"," H"," J"," L"," M"," P"," S"," T"," V"," W", /*
          */"RB","RD","RE","RH","RJ","RL","RM","RP","RS","RT","RV","RW") 
then nsw_nl_imp = 1; else nsw_nl_imp = 0;
if ph_F in (" B"," D"," E"," H"," J"," L"," M"," P"," S"," T"," V"," W", /*
          */"RB","RD","RE","RH","RJ","RL","RM","RP","RS","RT","RV","RW") 
then nph_imp = 1; else nph_imp = 0;
if ph_nl_F in (" B"," D"," E"," H"," J"," L"," M"," P"," S"," T"," V"," W", /*
          */"RB","RD","RE","RH","RJ","RL","RM","RP","RS","RT","RV","RW") 
then nph_nl_imp = 1; else nph_nl_imp = 0;

if cm_F in (" B"," D"," E"," H"," J"," L"," M"," P"," S"," T"," V"," W", /*
          */"RB","RD","RE","RH","RJ","RL","RM","RP","RS","RT","RV","RW") 
then ncm_imp = 1; else ncm_imp = 0;
if tab_F in (" B"," D"," E"," H"," J"," L"," M"," P"," S"," T"," V"," W", /*
           */"RB","RD","RE","RH","RJ","RL","RM","RP","RS","RT","RV","RW") 
then ntab_imp = 1; else ntab_imp = 0;
if tvs_F in (" B"," D"," E"," H"," J"," L"," M"," P"," S"," T"," V"," W", /*
           */"RB","RD","RE","RH","RJ","RL","RM","RP","RS","RT","RV","RW") 
then ntvs_imp = 1; else ntvs_imp = 0;

if ntvs_imp=1 or ncm_imp=1 or nph_imp = 1 or nsw_imp =1 or nww_imp =1 
or EE_F in (" V","RV","RH","RJ","RT"," D"," H"," J"," T"," L","RL") 
 or CF_F in (" V","RV","RH","RT"," B"," D"," H"," T") 
 or TIB_F in (" B","RB"," V","RV"," S","RS"," A"," E"," H"," L"," M"," T","RE","RH","RL","RM","RT") 
 or TIE_F in (" B","RB"," V","RV"," A"," E"," H"," L"," M","RE","RH","RL","RM","RT")
then any_impute=1;
else any_impute=0;

if ntvs_imp=1 or ncm_imp=1 or nph_imp = 1 or nsw_imp =1 or nww_imp =1 
or EE_F in (" V","RV","RH","RJ","RT"," D"," H"," J"," T"," L","RL") 
 or CF_F in (" V","RV","RH","RT"," B"," D"," H"," T") 
then any_imp_notTIB_TIE=1;
else any_imp_notTIB_TIE=0;

if any_impute=1 or tab_f in (" B"," D"," E"," H"," J"," L"," M"," P"," S"," T"," V"," W")
then any_imp_incl_TAB=1;
else any_imp_incl_TAB=0;

if pw_f = "" then pw_f_missing=1;
else  pw_f_missing=0;
if ww_f = "" then ww_f_missing=1;
else  ww_f_missing=0;
if ph_f = "" then ph_f_missing=1;
else  ph_f_missing=0;
run;


proc sort data=cmf2002_nonar nodupkey; 
by lbdnum; 
run;


/***
proc freq data=cmf2002_nonar;
 tables form_proc;
 title "form processed, 2002 CM, non-AR cases only";
run;
***/

proc freq data=cmf2002_nonar;
 tables PW_F PW_NL_f TE_F te_nl_f SW_F SW_NL_F WW_F ww_nl_f PH_F ph_nl_f CM_F TVS_F TAB_F TIB_F TIE_F CF_F EE_F;
 title "Edit/Impute flags, 2002 CMF file, non-AR cases only";
run;

/****
proc freq data=cmf2002_nonar;
 tables ET*pw_f_missing ET*WW_F_missing ET*PH_F_missing ;
 title1 "Interaction of ASM indicator with Edit/Impute flags missing indicator";
 title2 "2002 CMF file, non-AR cases only";
run;

proc freq data=cmf2002_nonar;
 tables form_proc*pw_f_missing ;
 title1 "Interaction of form type with PW Edit/Impute flags missing indicator";
 title2 "2002 CMF file, non-AR cases only";
run;

*****/


data asm01 (keep = lbdnum ee cf cm ph tvs ww pw te sw tib tie );
 set asm.asm2001;
run;

proc datasets library=work;
modify asm01;
rename ee = ee01  cf=cf01 cm=cm01 ph=ph01 tvs=tvs01 ww=ww01 pw=pw01 te=te01 sw=sw01 tib=tib01 tie=tie01;
run;

proc sort data=asm01 nodupkey; by lbdnum; run;


data cmf2002_nonar inasm01notincmf02;
 merge cmf2002_nonar (in=incmf02) asm01 (in=inasm01); 
by lbdnum;
if incmf02 then output cmf2002_nonar;
else output inasm01notincmf02;
run;


data allcmf.cmf2002_nonar;
 set cmf2002_nonar;
  PW_F2nd=substr(PW_F,2,1); 
  TE_F2nd=substr(TE_F,2,1); 
  WW_F2nd=substr(WW_F,2,1); 
  SW_NL_F2nd=substr(SW_NL_F,2,1); 
  PH_F2nd=substr(PH_F,2,1); 
  CM_F2nd=substr(CM_F,2,1); 
  EE_F2nd=substr(EE_F,2,1); 
  CF_F2nd=substr(CF_F,2,1); 
  TVS_F2nd=substr(TVS_F,2,1); 
  TAB_F2nd=substr(TAB_F,2,1);

  /* FOR SW (leased + non-leased) in 2002 the only flag set for non-AR cases is L. */
 
  if SW_NL_F='R '
  then SW_NL_Fgroup='reported_edit_passing';
  else if SW_NL_F in (" H"," L"," M"," P"," S"," V","RE","RH","RHQ","RL","RL1","RLQ","RP","RS","RV")
  then SW_NL_Fgroup='other_impute';
  else if SW_NL_F in (" 1"," 2"," 9"," AC"," C"," C1"," C3"," CQ"," G"," HC"," HQ"," L1"," L3", /*
*/" LC"," LQ", " SC"," U1","R2","R4","R9","RC","RC1","RCQ"," Z","RN","RU","RU1")
  then SW_NL_Fgroup='other non-impute';
  ELSE IF SW_NL_F in (" A"," AA"," AQ"," CA"," LA"," SA","RA","RAA","RAQ","RCA","RLA")
  then SW_NL_Fgroup='ad_rec';
  else IF SW_NL_F2nd ='B'
  then SW_NL_Fgroup='Beta_regression';
  else if missing(SW_NL_F) 
  then SW_NL_Fgroup='flag_missing';


  /* FOR TE in 2002 the only flags set for non-AR cases are B, E, H, and M. */
  IF TE_F2nd ='V'
  then TE_Fgroup='industry_average';
  else if TE_F="R "
  then TE_Fgroup='reported_edit_passing';
  else if TE_F="" 
  then TE_Fgroup='flag missing';
  else if TE_F2nd in ('G','K','N','O','U','X','Z')
  then TE_Fgroup='nonimp_other';
  ELSE IF TE_F2nd ='A'
  then TE_Fgroup='ad_rec';
  ELSE IF TE_F2nd ='C'
  then TE_Fgroup='analyst_corrected';
  ELSE IF TE_F2nd ='H'
  then TE_Fgroup='historical_data';
  ELSE IF TE_F2nd ='L'
  then TE_Fgroup='logical_impute';
  ELSE IF TE_F2nd ='S'
  then TE_Fgroup='direct_substitution';
  else if TE_F2nd in ('D','E','J','M','P','T','W')
  then TE_Fgroup='other_impute';
  else IF TE_F2nd ='B'
  then do;
    TE_Fgroup='Beta_regression';
    if sw01 ne . and te01 ne . then TE_Beta_model7=1;
    else TE_Beta_model7=0;
  end;
  else if missing(TE_F)
  then TE_Fgroup='flag_missing';

  if TE_NL_F="R "
  then TE_NL_Fgroup='reported_edit_passing';
  else IF TE_NL_F in (' B',' B1', 'RB','RB1','RBQ')
  then do;
      TE_NL_Fgroup='Beta_regression';
      if sw01 ne . and te01 ne . then TE_NL_Beta_model7=1;
      else TE_NL_Beta_model7=0;
  end;
  else if TE_NL_F in (" A"," AQ","RA","RAQ")
  then TE_NL_Fgroup = 'ad rec';
  ELSE IF TE_NL_F in (' 1',' 2',' 9',' E',' H',' L',' L1',' M',' P',' S',' V', /* 
*/ 'RL','RH','RHQ','RL1','RLQ','RP','RV')
  then TE_NL_Fgroup='other impute';
  else if missing(TE_NL_F)
  then TE_NL_Fgroup='flag_missing';
  else TE_NL_Fgroup='other non-impute';

  IF TVS_F in (" B","RB")
  then do;
      TVS_Fgroup='Beta_regression';
      if sw01 ne . and tvs01 ne . then TVS_Beta_model7=1;
      else TVS_Beta_model7=0;
  end;
  else if TVS_F2nd = "A"
  then TVS_Fgroup = 'ad rec';
  else if TVS_F in (" V","RV","RVK")
  then TVS_Fgroup = "industry average";
  else if TVS_F in (" BK"," E"," EC"," H"," J"," L", " M"," N"," P"," PK"," S"," SK"," HK")
  then TVS_Fgroup='other impute for non-response';
  else if TVS_F in ("  C"," G"," MC"," U"," BC"," C")
  then TVS_Fgroup='analyst correction or other non-impute for non-response';
  else if TVS_F="R "
  then TVS_Fgroup='reported_edit_passing';
  else if TVS_F="RL"
  then TVS_Fgroup='logical impute replacing response';
  else if TVS_F="" 
  then TVS_Fgroup='flag missing';
  else if TVS_F in ("RBK","RE","REK","RH","RLK","RM","RS")
  then TVS_Fgroup='other impute replacing response';
  else if TVS_F in ("R K","RC","RCK","RG","RN","RNK","RU","RX")
  then TVS_Fgroup = 'other non-impute replacing response';
  else if missing(TVS_F) then TVS_Fgroup = "flag missing";



  if TIB_F="R "
  then TIB_Fgroup='reported_edit_passing';
  else IF TIB_F in (" B","RB")
  then do; 
      TIB_Fgroup='Beta_regression';
      if tvs01 ne . and tib01 ne . then TIB_Beta_model7=1;
      else TIB_Beta_model7=0;
  end;
  else if TIB_F in (" V","RV")
  then TIB_Fgroup = 'industry average';
  else if TIB_F in (" S","RS"," A"," E"," H"," L"," M"," T","RE","RH","RL","RM","RT")
  then TIB_Fgroup = 'other impute';
  else if TIB_F in (" C"," G"," Z","RC","RG","RN","RX","RZ")
  then TIB_Fgroup = 'other non-impute';
  else if missing(TIB_F) 
  then TIB_Fgroup = "flag missing";



  if TIE_F="R "
  then TIE_Fgroup='reported_edit_passing';
  else IF TIE_F in (" B","RB")
  then do;
      TIE_Fgroup='Beta_regression';
      if tvs01 ne . and tie01 ne . then TIE_Beta_model7=1;
      else TIE_Beta_model7=0;
  end;
  else if TIE_F in (" V","RV")
  then TIE_Fgroup = 'industry average';
  else if TIE_F in (" A"," E"," H"," L"," M","RE","RH","RL","RM","RT")
  then TIE_Fgroup = 'other impute';
  else if TIE_F in (" C"," N"," X"," Z","RC","RG","RN","RU","RX","RZ")
  then TIE_Fgroup = 'other non-impute';
  else if missing(TIE_F) 
  then TIE_Fgroup = "flag missing";


  if CM_F="R "
  then CM_Fgroup='reported_edit_passing';
  else IF CM_F in (" B","RB")
  then do;
      CM_Fgroup='Beta_regression ';
      if tvs01 ne . and cm01 ne . then CM_Beta_model7=1;
      else CM_Beta_model7=0;
  end;
  ELSE IF CM_F =" C"
  then CM_Fgroup='analyst corrected after non-response';
  ELSE IF CM_F =" L"
  then CM_Fgroup='logical impute for non-response';
  else if CM_F in (" E"," H"," M","RE","RH","RL","RM") 
  then CM_Fgroup = "other impute ";
  else if CM_F in( ""," ") 
  then CM_Fgroup='flag missing';
  else if CM_F in ("RC","RN"," U")
  then CM_Fgroup="other non-impute";
  else if missing(CM_F) 
  then CM_Fgroup = "flag missing";


  IF PW_F2nd ='V'
  then PW_Fgroup='industry_average';
  else if PW_F="R "
  then PW_Fgroup='reported_edit_passing';
  else if PW_F="" 
  then PW_Fgroup='flag missing';
  else if PW_F2nd in ('G','K','N','O','U','X','Z')
  then PW_Fgroup='nonimp_other';
  ELSE IF PW_F2nd ='A'
  then PW_Fgroup='ad_rec';
  ELSE IF PW_F2nd ='C'
  then PW_Fgroup='analyst_corrected';
  ELSE IF PW_F2nd ='S'
  then PW_Fgroup='direct_substitution';
  else if PW_F2nd in ('L','H','D','E','J','M','P','T','W')
  then PW_Fgroup='other_impute';
  else IF PW_F2nd ='B'
  then PW_Fgroup='Beta_regression';
  else if missing(PW_F)
  then PW_Fgroup = "flag_missing";


  if PW_NL_F="R "
  then PW_NL_Fgroup='reported_edit_passing';
  else IF PW_NL_F in (' B', 'RB')
  then PW_NL_Fgroup='Beta_regression';
  else if missing(PW_NL_F)
  then PW_NL_Fgroup='flag_missing';  /** NEED TO ADD CODE TO LOOK AT THE MISSING PW_NL FLAGS--ARE THESE PLANTS WITH PW_NL=0? ***/
  else PW_NL_Fgroup='other';


  if CF_F="R "
  then CF_Fgroup='reported_edit_passing';
  else IF CF_F in (" V","RV")
  then CF_Fgroup='industry_average';
  else if CF_F in (" C"," N"," U","RC","RK","RN","RU","")
  then CF_Fgroup='other non-impute';
  else if CF_F in (" H"," T","RH","RT")
  then CF_Fgroup='other impute';
  else if missing(CF_F) 
  then CF_Fgroup = "flag missing";


  if EE_F="R "
  then EE_Fgroup='reported_edit_passing';
  else IF EE_F in (" V","RV")
  then EE_Fgroup='industry_average';
  else if EE_F in ("RC","RK","RN","RU","  C"," C"," N"," U"," VC","")
  then EE_Fgroup='other non-impute';
  else if EE_F in ("RH","RT"," B"," D"," H"," T")
  then EE_Fgroup='other impute';
  else if missing(EE_F) 
  then EE_Fgroup = "flag missing";


  IF WW_F2nd ='V'
  then WW_Fgroup='industry_average';
  else if WW_F="R "
  then WW_Fgroup='reported_edit_passing';
  else if WW_F="" 
  then WW_Fgroup='flag missing';
  else if WW_F2nd in ('G','K','N','O','U','X','Z')
  then WW_Fgroup='nonimp_other';
  ELSE IF WW_F2nd ='A'
  then WW_Fgroup='ad_rec';
  ELSE IF WW_F2nd ='C'
  then WW_Fgroup='analyst_corrected';
  ELSE IF WW_F2nd ='S'
  then WW_Fgroup='direct_substitution';
  else if WW_F2nd in ('L','H','D','E','J','M','P','T','W')
  then WW_Fgroup='other_impute';
  else IF WW_F2nd ='B'
  then do;
      WW_Fgroup='Beta_regression';
      if (sw01 ne . and ww01 ne .) or (pw01 ne . and ww01 ne .) then WW_Beta_model7=1;
      else WW_Beta_model7=0;
  end;
  else if missing(WW_F) 
  then WW_Fgroup = "flag missing";


  if WW_NL_F="R "
  then WW_NL_Fgroup='reported_edit_passing';
  else IF WW_NL_F IN (' B','RB')
  then do; 
      WW_NL_Fgroup='Beta_regression';
      if (sw01 ne . and ww01 ne .) or (pw01 ne . and ww01 ne .) then WW_NL_Beta_model7=1;
      else WW_NL_Beta_model7=0;
  end;
  else IF WW_NL_F in (" H"," L"," M","RL")
  then WW_NL_Fgroup='other impute';
  else if missing(WW_NL_F) 
  then WW_NL_Fgroup = "flag missing";
  else WW_NL_Fgroup='other non-impute';

  if PH_F="" 
  then PH_Fgroup='flag missing';
  else IF PH_F in (" B","RB")
  then do;
      PH_Fgroup='Beta_regression ';
      if (pw01 ne . and ph01 ne .) or (ww01 ne . and ph01 ne .) then PH_Beta_model7=1;
      else PH_Beta_model7=0;
  end;
  else IF PH_F ="RS"
  then PH_Fgroup='Direct substution replacing response';
  else if PH_F in (" E"," H"," L"," M","RL")
  then PH_Fgroup='other impute';
  else if missing(PH_F) 
  then PH_Fgroup = "flag missing";


  if PH_NL_F="R " 
  then PH_NL_Fgroup='reported edit passing';
  else IF PH_NL_F in (" B","RB")
  then do;
      PH_NL_Fgroup='Beta_regression ';
      if (pw01 ne . and ph01 ne .) or (ww01 ne . and ph01 ne .) then PH_NL_Beta_model7=1;
      else PH_NL_Beta_model7=0;
  end;
  else IF PH_NL_F in (" H"," L"," M","RL","RS")
  then PH_NL_Fgroup='other impute';
  else if missing(PH_NL_F) 
  then PH_NL_Fgroup = "flag missing";
  else PH_NL_Fgroup='other non-impute';

  if TAB_F="R "
  then TAB_Fgroup='reported_edit_passing';
  else if TAB_F in (" B"," D"," L","RS","RT")
  then TAB_Fgroup= "other impute";
  else if TAB_F in (" C"," I"," K"," KC","RC","RK","RN","")
  then TAB_Fgroup='other non-impute';
  else if missing(TAB_F) 
  then TAB_Fgroup = "flag missing";

  if TAE_F="R "
  then TAE_Fgroup='reported_edit_passing';
  else if TAE_F in (" L","RS","RT","RL","RV")
  then TAE_Fgroup= "other impute";
  else if TAE_F in (" C"," I"," K"," KC","RC","RK","RN","","RI","RS")
  then TAE_Fgroup='other non-impute';
  else if missing(TAE_F) 
  then TAE_Fgroup = "flag missing";


run;

proc freq data=allcmf.cmf2002_nonar;
 tables SW_NL_Fgroup TE_Fgroup TE_NL_Fgroup TE_NL_Fgroup TVS_Fgroup CM_Fgroup PW_Fgroup PW_NL_Fgroup WW_Fgroup WW_NL_Fgroup PH_Fgroup PH_NL_Fgroup EE_Fgroup CF_Fgroup TAB_Fgroup TAE_Fgroup TIB_Fgroup TIE_Fgroup any_impute /*
 */ any_imp_notTIB_TIE any_imp_incl_TAB;
 title1 "Groups of Edit/Impute flags, ";
 title2 "2002 CM, non-AR cases only";
run;


proc freq data=allcmf.cmf2002_nonar;
 tables TE_Beta_model7 TE_NL_Beta_model7 TVS_Beta_model7 TIB_Beta_model7 TIE_Beta_model7 CM_Beta_model7  WW_Beta_model7 WW_NL_Beta_model7 PH_Beta_model7 PH_NL_Beta_model7;
 title1 "Model 1 (=0) vs. Model 7 Beta imputes, ";
 title2 "2002 CM, non-AR cases only";
run;



/** Disclosure analysis: only need to look at firm counts. */


%macro do_DA(var=);

 * adding up to the firm level;
 proc summary data=allcmf.cmf2002_nonar nway;
   class  &var id;
   var tvs;
 output out=chk sum=;

 *adding up to the entire sample level;
 proc summary data=chk nway;
  class  &var;
  var tvs;
 output out=chkall sum=;

 data chkall;
  set chkall;
  firmcount=_freq_;

 title "The number of firms in the sample";run;
 proc print data=chkall;var &var firmcount tvs;


%mend;



%macro do_DA_on_groups(var=);

 * adding up to the firm level;
 proc summary data=allcmf.cmf2002_nonar nway;
   class &var firmid;
   var tvs;
 output out=chk sum=;

 *adding up to the entire sample level;
 proc summary data=chk nway;
  class  &var;
  var tvs;
 output out=chkall sum=;

 data chkall;
  set chkall;
  firmcount=_freq_;

 title "The number of firms in the sample";run;
 proc print data=chkall;var &var firmcount tvs;


%mend;


%do_DA_on_groups(var=SW_NL_Fgroup);
%do_DA_on_groups(var=TE_Fgroup);
%do_DA_on_groups(var=TE_NL_Fgroup);
%do_DA_on_groups(var=TVS_Fgroup);
%do_DA_on_groups(var=CM_Fgroup);
%do_DA_on_groups(var=PW_Fgroup);
%do_DA_on_groups(var=PW_NL_Fgroup);
%do_DA_on_groups(var=WW_Fgroup);
%do_DA_on_groups(var=WW_NL_Fgroup);
%do_DA_on_groups(var=PH_Fgroup);
%do_DA_on_groups(var=PH_NL_Fgroup);
%do_DA_on_groups(var=EE_Fgroup);
%do_DA_on_groups(var=CF_Fgroup);
%do_DA_on_groups(var=TAB_Fgroup);
%do_DA_on_groups(var=TAE_Fgroup);
%do_DA_on_groups(var=TIB_Fgroup);
%do_DA_on_groups(var=TIE_Fgroup);


%do_DA_on_groups(var=TE_Beta_model7);
%do_DA_on_groups(var=TE_NL_Beta_model7);
%do_DA_on_groups(var=TVS_Beta_model7);
%do_DA_on_groups(var=TIB_Beta_model7);
%do_DA_on_groups(var=TIE_Beta_model7);
%do_DA_on_groups(var=CM_Beta_model7);
%do_DA_on_groups(var=WW_Beta_model7);
%do_DA_on_groups(var=WW_NL_Beta_model7);
%do_DA_on_groups(var=PH_Beta_model7);
%do_DA_on_groups(var=PH_NL_Beta_model7);

%do_DA_on_groups(var=any_impute);


